<!DOCTYPE html>
<html>
<head>
    <title>微信公众号支付</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/app/css/wxzf.css">
</head>
<body class="bc-bg" ontouchstart>
<div class="header">
    <!--<div class="all_w ">-->
        <!--<div class="gofh"> <a href="#"><img src="__PUBLIC__/app/img/jt_03.jpg" ></a> </div>-->
        <!--<div class="ttwenz">-->
            <!--<h4>确认交易</h4>-->
            <!--<h5>微信安全支付</h5>-->
        <!--</div>-->
    <!--</div>-->
</div>
<div class="wenx_xx">
    <div class="mz">微信公众号交易付款</div>
    <div class="wxzf_price">￥{$pay_cash}</div>
</div>
<a href="javascript:void(0);" class="ljzf_but all_w" onClick="callpay()">立即支付</a>
</body>

<script type="text/javascript">
    var trade_obj = {$jsApiParameters};
    (function () {
        var titHeight = $('#header').height();
        $('.mrcontent').css({'margin-top': titHeight});
    })();
    //调用微信JS api 支付
    function jsApiCall() {
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                trade_obj,
                function (res) {
                    if (res.err_msg == 'get_brand_wcpay_request:ok') {
                        if ("{:input('type')}" == '1') {
                            location.href = "http://b.xtaoyuan.com";
                        } else {
                            location.href = "http://b.xtaoyuan.com";
                        }
                    }
                    location.href = "http://b.xtaoyuan.com";
                }
        )
        ;
    }

    function callpay() {
        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        } else {
            jsApiCall();
        }
    }
</script>